package fag.core.game.test.arkanoid;

import fag.core.game.StandardDoodad;
import fag.core.geometry.Vector2D;

public class Ball extends StandardDoodad {

	public Vector2D speed = new Vector2D(160, 160);
	
	public boolean attached = false;
	
	public Ball() {
		super(new BallModel());
	}
	
	public void bounce(Vector2D normal) {
		speed = speed.add(normal.mul(normal.dot(speed.mul(-1)) * 2));
	}
	
	public void step(double dt) {
		if(!attached)
			translate(speed.x * dt, speed.y * dt, Referential.ABSOLUTE);
	}
}
